package com.pic.mgt.monitor.parser.syushin;

import java.io.File;

import com.pic.mgt.monitor.WrongUnitFormatException;
import com.pic.mgt.monitor.parser.FormatParser;

// (送多方新增)
public class SyushinMessageApNameParser extends FormatParser {

	@Override
	public String parse(Object _messageConfirmationFile) throws WrongUnitFormatException {
		super.checkObjectType(_messageConfirmationFile, File.class);
		
		File messageConfirmationFile = (File)_messageConfirmationFile;
		
		File parentFolder = messageConfirmationFile.getParentFile();
		if (null != parentFolder) {
			return parentFolder.getName().trim();
		}
		else {
			throw new WrongUnitFormatException(
					"Can't parse AP name from confirmation file '" + messageConfirmationFile.getAbsolutePath() + "' of message.");
		}
	}

}
